//数据格式注册——奔驰宝马
//数据格式注册——百人妞妞
module RegDataBrebg {
    //公共宏定义
    let GAME_STATUS_PLAY = 100
    export let KIND_ID = 120									//游戏 I D
    export let GAME_PLAYER = 6							//游戏人数
    export let GAME_NAME = "百人二八杠"				//游戏名字

    //状态定义
    export let GS_PLACE_JETTON = GAME_STATUS_PLAY					//下注状态
    export let GS_GAME_END = GAME_STATUS_PLAY + 1					//结束状态
    export let GS_MOVECARD_END = GAME_STATUS_PLAY + 2					//结束状态

    //区域索引
    export let ID_SHANG_MEN = 1									//上门
    export let ID_TIAN_MEN = 2									//天门
    export let ID_XIA_MEN = 3									//下门
    export let AREA_COUNT = 3									//区域数目

    //玩家索引
    export let BANKER_INDEX = 0									//庄家索引
    export let SHANG_MEN_INDEX = 1									//上门索引
    export let TIAN_MEN_INDEX = 2									//天门索引
    export let XIA_MEN_INDEX = 3									//下门索引
    export let MAX_INDEX = 3									//最大索引

    export let SERVER_LEN = 32									//房间长度
    export let MAX_CARD = 2
    export let MAX_CARDGROUP = 4
    export let CONTROL_AREA = 3									//受控区域

    //占座
    export let SEAT_SEAT1_INDEX = 0									//左一
    export let SEAT_SEAT2_INDEX = 1									//左二
    export let SEAT_SEAT3_INDEX = 2									//左三
    export let SEAT_SEAT4_INDEX = 3									//左四
    export let SEAT_SEAT5_INDEX = 4									//右二
    export let SEAT_SEAT6_INDEX = 5									//右三
    export let SEAT_SEAT7_INDEX = 6									//右三
    export let SEAT_SEAT8_INDEX = 7									//右三
    export let MAX_OCCUPY_SEAT_COUNT = 8									//最大占位个数
    export let SEAT_INVALID_INDEX = 0xFFFF								//无效索引

    //请求坐下
    export let CMD_GP_UserQuickSitdown = {
        wMainCmdID: 3,
        wSubCmdID: 3,
        nLenght: 70,
        data: [
            ["wTableID", "WORD"],
            ["wChairID", "WORD"],
            ["szInsurePass", "TCHAR", 33],
        ]
    }
    //用户下注
    export let CMD_GP_PlaceJetton = {
        wMainCmdID: 200,
        wSubCmdID: 1,
        nLenght: 9,
        data: [
            ["cbJettonArea", "BYTE"],    //下注项目
            ["lJettonScore", "DLONG"],   //下注数量
        ]

    }
    // //玩家申请坐庄（使用）
    // export let CMD_GP_ApplyBanker = {
    //     wMainCmdID: 200,
    //     wSubCmdID: 2,
    //     nLenght: 0,
    //     data: [

    //     ]

    // }
    //发牌模式
    export let CMD_GP_CancelBanker = {
        wMainCmdID: 200,
        wSubCmdID: 6,
        nLenght: 2,
        data: [
            ["cbPutCardMode", "BYTE"],    //摆牌模式
            ["cbSendCardMode", "BYTE"],   //发牌模式
        ]
    }
    //庄家申请列表
    export let CMD_GP_ContinueCard = {
        wMainCmdID: 9,
        wSubCmdID: 4,
        nLenght: 0,
        data: [

        ]

    }
    //开奖记录
    export let CMD_GP_AmdinCommand = {
        wMainCmdID: 9,
        wSubCmdID: 5,
        nLenght: 0,
        data: [

        ]

    }
    //获取申请上庄列表
    export let CMD_GP_GetAccount = {
        wMainCmdID: 9,
        wSubCmdID: 20,
        nLenght: 0,
        data: [

        ]

    }

    //开始游戏
    export let CMD_GP_StartGame = {
        wMainCmdID: 100,
        wSubCmdID: 1,
        nLenght: 9,
        data: [
            ["wVisit", "BYTE"],
            ["wVersion", "DWORD"],
            ["wGameVersion", "DWORD"]
        ]
    }

    //游戏空闲
    export let gameFree = [
        ["cbTimeLeave", "BYTE"],        //剩余时间

        ["lUserMaxScore", "DLONG"],        //玩家金币

        ["wBankerUser", "WORD"],        //当前庄家
        ["cbBankerTime", "WORD"],        //庄家局数
        ["lBankerWinScore", "DLONG"],        //庄家成绩
        ["lBankerScore", "DLONG"],        //庄家分数
        ["bEnableSysBanker", "BOOL"],        //系统做庄

        ["cbTableHavaSendCardArray", "BYTE[][]", 4, 10],       //桌面扑克
        ["cbTableHavaSendCount", "BYTE[]", 4],       //桌面扑克
        ["cbLeftCardCount", "BYTE"],       //扑克数目
        ["wSeatPlays", "WORD[]", MAX_OCCUPY_SEAT_COUNT],       //占位椅子

        ["lApplyBankerCondition", "DLONG"],        //申请条件
        ["lAreaLimitScore", "DLONG"],        //区域限制

        ["szGameRoomName", "TCHARS", 32],        //房间名称
    ];
    //游戏下注
    export let gamePlay = [
        ["lCellScore", "DLONG[]", AREA_COUNT + 1],        //全体总注

        ["lUserJettonScore", "DLONG[]", AREA_COUNT + 1],        //个人总注

        ["cbTableHavaSendCardArray", "BYTE[][]", 4, 10],       //桌面扑克
        ["cbTableHavaSendCount", "BYTE[]", 4],       //桌面扑克
        ["cbLeftCardCount", "BYTE"],       //扑克数目

        ["lUserMaxScore", "DLONG"],        //最大下注

        ["lApplyBankerCondition", "DLONG"],        //申请条件
        ["lAreaLimitScore", "DLONG"],        //区域限制

        ["cbTableCardArray", "BYTE[][]", 4, 2],       //桌面扑克
        ["wSeatPlays", "WORD[]", MAX_OCCUPY_SEAT_COUNT],       //占位椅子
        ["lSeatScore", "DLONG[]", MAX_OCCUPY_SEAT_COUNT],       //占位玩家成绩

        ["wBankerUser", "WORD"],        //当前庄家
        ["cbBankerTime", "WORD"],        //庄家局数
        ["lBankerWinScore", "DLONG"],        //庄家赢分
        ["lBankerScore", "DLONG"],        //庄家分数
        ["bEnableSysBanker", "BOOL"],        //系统做庄

        ["lEndBankerScore", "DLONG"],        //庄家成绩
        ["lEndUserScore", "DLONG"],        //玩家成绩
        ["lEndUserReturnScore", "DLONG"],        //返回积分
        ["lEndRevenue", "DLONG"],        //游戏税收

        ["cbTimeLeave", "BYTE"],        //剩余时间
        ["cbGameStatus", "BYTE"],        //游戏状态
        ["szGameRoomName", "TCHARS", 32],        //房间名称

    ]



    export let MainCMD_MsgId = {
        1: {
            //登陆成功
            100: [
                ["dwUserRight", "DWORD"],        //用户权限
                ["dwMasterRight", "DWORD"],       //管理权限
            ],
            //登陆失败
            101: [
                ["lErrorCode", "DWORD"],        //错误代码
                ["szDescribeString", "TCHARS", 128],       //描述
            ],
            //登陆完成
            102: [


            ],
            //登陆游戏时发现在其他房间
            103: [
                ["wServerID", "WORD"],        //其他游戏房间的serverID
            ],
            //重选服务器-选桌类型
            104: [

            ],
            //升级提示
            200: [
                ["cbMustUpdatePlaza", "BYTE"],        //强行升级
                ["cbMustUpdateClient", "BYTE"],       //强行升级
                ["cbAdviceUpdateClient", "BYTE"],        //建议升级
                ["dwCurrentPlazaVersion", "DWORD"],       //当前版本
                ["dwCurrentFrameVersion", "DWORD"],        //当前版本
                ["dwCurrentClientVersion", "DWORD"],       //当前版本
            ]
        },
        2: {
            //列表配置
            100: [
                ["cbColumnCount", "BYTE"],      //列表数目
                ["ColumnItem", "STRUCT[]", [
                    ["cbColumnWidth", "BYTE"],        //列表宽度
                    ["cbDataDescribe", "BYTE"],        //字段类型
                    ["szColumnName", "TCHAR", 16],       //列表名字
                ], 16],        //列表描述
            ],
            //房间配置
            101: [
                ["wTableCount", "WORD"],        //桌子数目
                ["wChairCount", "WORD"],        //椅子数目
                ["wServerType", "WORD"],        //房间类型
                ["dwServerRule", "DWORD"],        //房间规则
            ],
            //完成配置
            103: [

            ],
            //玩家权限
            104: [
                ["dwUserRight", "DWORD"],        //玩家权限
            ],
        },
        3: {
            //用户规则
            1: [
                ["cbRuleMask", "BYTE"],        //规则掩码
                ["wMinWinRate", "WORD"],        //最低胜率
                ["wMaxFleeRate", "WORD"],        //最高逃率
                ["lMaxGameScore", "LONG"],        //最高分数
                ["lMinGameScore", "LONG"],        //最低分数
                ["szPassword", "TCHAR", 33],        //桌子密码
            ],
            //旁观请求
            2: [

            ],
            //请求坐下
            3: [
                ["wTableID", "WORD"],        //桌子位置
                ["wChairID", "WORD"],        //椅子位置
                ["szPassword", "TCHAR", 33],        //桌子密码
            ],
            //拒绝黑名单坐下
            7: [
                ["wTableID", "WORD"],        //桌子位置
                ["wChairID", "WORD"],        //椅子位置
                ["dwUserID", "TCHAR", 33],        //用户ID
                ["dwRepulseUserID", "DWORD"]        //用户ID
            ],
            //提出用户
            8: [
                ["dwTargetUserID", "DWORD"],        //用户标识
            ],
            //用户信息
            100: [
                ["tagMobileUserInfoHead", "SPSTRUCT", [
                    ["dwGameID", "DWORD"],        //游戏 I D
                    ["dwUserID", "DWORD"],        //用户 I D
                    ["dwGroupID", "DWORD"],        //社团 I D
                    ["wFaceID", "WORD"],        //头像索引
                    ["dwCustomID", "DWORD"],        ////自定标识
                    ["bIsAndroid", "BOOL"],        ////机器标识
                    ["cbGender", "BYTE"],        ////用户性别
                    ["cbMemberOrder", "BYTE"],        ////会员等级
                    ["cbTrader", "BYTE"],        ////管理等级
                    ["wTableID", "WORD"],        ////桌子索引
                    ["wChairID", "WORD"],        ////椅子索引
                    ["cbUserStatus", "BYTE"],        ////用户状态
                    ["lScore", "DLONG"],        ////用户分数  用户的money
                    ["lGrade", "DLONG"],        ////用户成绩
                    ["lInsure", "DLONG"],        ////用户银行
                    ["lIngot", "DLONG"],        ////用户元宝
                    ["dBeans", "DOUBLE"],        ////用户游戏豆
                    ["dwWinCount", "DWORD"],        //胜利盘数
                    ["dwLostCount", "DWORD"],        //失败盘数
                    ["dwDrawCount", "DWORD"],        //和局盘数
                    ["dwFleeCount", "DWORD"],        //逃跑盘数
                    ["dwExperience", "DWORD"],        //用户经验
                    ["lLoveLiness", "DWORD"],        //用户魅力
                    ["lIntegralCount", "DLONG"],        //积分总数
                    ["dwAgentID", "DWORD"],        //代理 I D
                ]]
            ],
            //用户分数
            101: [
                ["dwUserID", "DWORD"],        //桌子位置
                ["UserScore", "STRUCT", [
                    ["lScore", "DLONG"],        //用户分数
                    ["lGrade", "DLONG"],        //用户成绩
                    ["lInsure", "DLONG"],        //用户银行
                    ["lIngot", "DLONG"],        //用户银行
                    ["dBeans", "BYTE"],        //用户银行
                    ["dwWinCount", "DWORD"],        //胜利盘数
                    ["dwLostCount", "DWORD"],        //失败盘数
                    ["dwDrawCount", "DWORD"],        //和局盘数
                    ["dwFleeCount", "DWORD"],        //逃跑盘数
                    ["dwUserMedal", "DLONG"],        //用户奖牌
                    ["dwExperience", "DWORD"],        //用户经验
                    ["lLoveLiness", "DLONG"]        //用户魅力
                ]],        //积分信息
            ],

            //用户状态
            102: [
                ["dwUserID", "DWORD"],        //用户标识
                ["tableId", "WORD"],
                ["wChairID", "WORD"],
                ["cbUserStatus", "BYTE"]
            ],
            //请求失败
            103: [
                ["lErrorCode", "LONG"],        //错误码
                ["wServerType", "WORD"],        //错误码
                ["szDescribeString", "TCHARS", 256]        //描述信息
            ],
            //踢出用户
            104: [
                ["dwTargetUserID", "DWORD"],        //目标用户
            ],
        },
        100: {
            //游戏状态
            100: [
                ["cbGameStatus", "BYTE"],        //游戏状态
                ["cbAllowLookon", "BYTE"],        //旁观标志
            ],
            101: [

            ],
            //用户匹配状态
            103: [],
            //可进行游戏状态
            104: [],
            //系统消息
            200: [
                ["wType", "WORD"],        //消息类型
                ["wLength", "WORD"],        //消息长度
                ["szString", "TCHARS", 1024],        //内容
            ],
            300: [
                ["szSerialNumber", "TCHARS", 66] //牌局编号
            ]
        },

        4: {
            //桌子信息
            100: [
                ["wTableCount", "WORD"],        //桌子数量
                ["TableStatusArray", "STRUCT[]", [
                    ["cbTableLock", "BYTE"],     //锁定标志
                    ["cbPlayStatus", "BYTE"],       //游戏标志
                ], 512] //桌子状态
            ],
            //桌子状态
            101: [
                ["wTableID", "WORD"],        //桌子数量
                ["TableStatus", "STRUCT", [
                    ["cbTableLock", "BYTE"],     //锁定标志
                    ["cbPlayStatus", "BYTE"],       //游戏标志
                ]] //桌子状态
            ]

        },
        5: {
            //银行资料返回
            100: [
                ["cbActivityGame", "BYTE"],        //游戏动作
                ["wRevenueTake", "WORD"],        //税收比列
                ["wRevenueTransfer", "WORD"],        //税收比列
                ["wServerID", "WORD"],        //房间标识
                ["lUserScore", "SCORE"],        //用户金币
                ["lUserInsure", "SCORE"],        //银行金币
                ["lTransferPrerequisite", "SCORE"],        //转账条件
            ],
            //银行操作成功
            101: [
                ["cbActivityGame", "BYTE"],        //游戏动作
                ["lUserScore", "SCORE"],        //身上金币
                ["lUserInsure", "SCORE"],        //银行金币
                ["szDescribeString", "CHINESE", 128],        //描述消息
            ],
            //银行操作失败
            102: [
                ["cbActivityGame", "BYTE"],        //游戏动作
                ["lErrorCode", "LONG"],        //错误代码
                ["szDescribeString", "CHINESE", 128],        //描述消息
            ],
        },
        // //管理员命令
        // 6:{
        //     //警告消息
        //     1:[
        //         ["wChatLength", "WORD"],        //信息长度
        //         ["dwTargetUserID", "DWORD"],        //目标用户
        //         ["szWarningMessage", "CHINESE",128],        //警告消息
        //     ],
        //     //接受消息
        //     2:[
        //         ["cbGame", "WORD"],        //游戏标识
        //         ["cbRoom", "DWORD"],        //房间标识
        //         ["cbAllRoom", "CHINESE",128],        //所有房间
        //         ["wChatLength", "DWORD"],              //消息长度
        //         ["szSystemMessage", "CHINESE",128],        //系统消息
        //     ],
        // },

        8: {
            //游戏状态
            100: [
                ["cbGameStatus", "WORD"],        //游戏状态
                ["cbAllowLookon", "DWORD"],        //旁观标志
            ],
            //用户匹配状态
            103: [],
            //可进行游戏状态
            104: [],
            //系统消息
            200: [
                ["wType", "WORD"],        //游戏状态
                ["szName", "DWORD"],        //mingzi
                ["wLength", "WORD"],        //游戏状态
                ["szString", "CHINESE", 1024],        //内容
            ],

        }
        ,
        9: {

            //游戏开始
            100: [
                ["cbTimeLeave", "WORD"],   //剩余时间
            ],
            //用户下注
            101: [

                ["wUserID", "DWORD"],      //下注玩家ID
                ["wBetItem", "WORD"],   //下注项目
                ["wBetAmount", "LONGLONG"],       //下注数量
                ["ItemBetAmountNum", "WORD"],       //下注项总数量
                ["ItemBetAmount", "STRUCT[]", [
                    ["wBetItem", "WORD"],      //下注项目
                    ["dwBetAmounts", "DWORD"],   //下注金额
                ], 0],   //各下注项已下分  

            ],

            //申请庄家
            102: [
                ["successful", "WORD"],
                ["wApplyBankerNum", "WORD"],
                ["dwUserid", "DWORD"],
            ],
            //下注失败
            103: [

            ],
            //取消申请
            104: [
                ["successful", "WORD"],       //1:取消成功 0:失败
                ["wApplyBankerNum", "WORD"],       //申请庄家数
                ["dwUserid", "DWORD"],    //取消申请玩家ID  
            ],

            //开奖状态
            107: [
                ["dwTimeLeave", "DWORD"],    //剩余时间
            ],
            //空闲状态
            108: [
                ["dwTimeLeave", "DWORD"],
            ],
            //庄家申请列表
            109: [

            ],
            //剔除队列
            112: [

            ],
            //机器人投注
            113: [
                // ["VecSize", "DWORD"], //取消玩家
                // ["AndroidPlaceInfoVec", "STRUCT[]",[
                //     ["wBetItem", "WORD"],      //下注项目
                //      ["dwBetAmounts", "DWORD"],   //下注金额
                // ],1], //取消玩家
            ],
            //机器人抢庄
            114: [

            ],
            //真人下注
            115: [
                ["cbJettonArea", "BYTE"], //筹码区域
                ["lJettonScore", "LONGLONG"], //加注数量
            ],

            //庄家信息列表
            120: [
                ["cbApplyNum", "BYTE"], //申请庄家人数
                ["sApplyBanker", "STRUCT[]", [
                    ["lScore", "LONGLONG"], //用户金币
                    ["szNickName", "CHINESE", 32], //用户昵称
                ], 5], //申请庄家信息
            ],
            //庄家信息
            121: [
                ["cbContinue", "BYTE"], //连续坐庄次数

                ["szNickName", "CHINESE", 32], //庄家名称
            ],




        },
        200: {
            //游戏空闲
            99: [
                ["cbTimeLeave", "BYTE"],//剩余时间
                ["lStorageStart", "DLONG"],//库存数值
            ],
            //游戏开始
            100: [
                ["wBankerUser", "WORD"],        //庄家位置
                ["lBankerScore", "DLONG"],        //庄家金币
                ["lUserMaxScore", "DLONG"],    //我的金币
                ["cbTableHavaSendCardArray", "BYTE[][]", 4, 10],       //桌面扑克
                ["cbTableHavaSendCount", "BYTE[]", 4],       //桌面扑克
                ["cbLeftCardCount", "BYTE"],       //扑克数目
                ["wSeatPlays", "WORD[]", MAX_OCCUPY_SEAT_COUNT],       //占位椅子
                ["cbTimeLeave", "BYTE"],  //剩余时间
                ["bContiueCard", "BOOL"]  //继续发牌
            ],
            //用户下注
            101: [

                ["wChairID", "WORD"],    //位置
                ["cbJettonArea", "BYTE"],     //筹码区域  
                ["lJettonScore", "DLONG"],    //加注数目
                ["bIsAndroid", "BOOL"],       //是否机器人
                ["bAndroid", "BOOL"],       //机器标识

            ],
            // 游戏结束
            102: [
                ["cbTimeLeave", "BYTE"],       //剩余时间
                ["cbTableCardArray", "BYTE[][]", 4, 2],       //桌面扑克
                ["cbTableHavaSendCardArray", "BYTE[][]", 4, 10],       //桌面扑克
                ["cbTableHavaSendCount", "BYTE[]", 4],       //桌面扑克
                ["cbLeftCardCount", "BYTE"],       //扑克数目
                ["bcFirstCard", "BYTE"],       //
                ["bcNextCard", "BYTE"],       //
                ["lBankerScore", "DLONG"],       //庄家成绩
                ["lBankerTotallScore", "DLONG"],       //庄家成绩
                ["nBankerTime", "DWORD"],       //做庄次数
                ["lUserScore", "DLONG"],       //玩家成绩
                ["lUserReturnScore", "DLONG"],       //返回积分
                ["lRevenue", "DLONG"],       //游戏税收
                ["lServerFees", "DLONG"],       //游戏服务费
                ["bWinShangMen", "BYTE"],       //上门胜利
                ["bWinTianMen", "BYTE"],       //天门胜利
                ["bWinXiaMen", "BYTE"],       //下门胜利
            ],
            //申请庄家
            103: [
                ["wApplyUser", "WORD"], //申请玩家
                ["bAndroid", "BOOL"], //是否机器人
            ],
            // 切换庄家
            104: [
                ["wBankerUser", "WORD"],    //当庄玩家
                ["lBankerScore", "DLONG"],    //庄家金币
                ["bAndroid", "BOOL"], //是否机器人

            ],
            // 更新积分
            105: [
                ["wChairID", "WORD"],    //椅子号码
                ["lScore", "DOUBLE"],    //玩家积分
                ["wChairID", "WORD"],    //当庄玩家
                ["wCurrentBankerChairID", "WORD"],    //当庄玩家
                ["cbBankerTime", "BYTE"],    //庄家局数
                ["lCurrentBankerScore", "DOUBLE"],    //庄家分数
            ],
            //游戏记录
            106: [
                ["struGameRecord", "STRUCT[]", [
                    ["bWinShangMen", "BOOL"],     //上门胜利
                    ["bWinTianMen", "BOOL"],     //天门胜利
                    ["bWinXiaMen", "BOOL"],     //下门胜利
                    ["cbBankMan", "BYTE"],     //庄家
                    ["cbShangMen", "BYTE"],     //上门
                    ["cbTianMen", "BYTE"],     //天门
                    ["cbXiaMen", "BYTE"],    //下门
                ], 16], //游戏空闲
            ],

            //用户下注失败
            107: [
                ["wPlaceUser", "WORD"],     //下注玩家
                ["lJettonArea", "BYTE"],     //下注区域
                ["lPlaceScore", "DLONG"],    //当前下注
            ],

            //取消申请  9   3
            108: [
                ["szCancelUser", "WORD"], //取消玩家
                ["bAndroid", "BOOL"], //是否机器人

            ],
            //取消申请  9   3
            109: [
                ["szCancelUser", "WORD"], //取消玩家
                ["bAndroid", "BOOL"], //是否机器人

            ],
            //发牌模式 
            110: [
                ["lJettonScore", "DLONG"], //
            ],
            //玩家抢庄 
            112: [
                ["wCatchUser", "WORD"], //抢庄玩家
            ],
            200: [
                ["structUserList", "STRUCT[]", [
                    ["wFaceID", "WORD"], //头像标识
                    ["szCityName", "TCHARS", 16], //头像标识
                    ["lTakeMinScore", "DLONG"], //头像标识
                ], 200], //游戏空闲
            ],

        }
        ,
        1000: {
            1: [
                ["wType", "WORD"],  //消息类型 1聊天消息 2弹出消息 4全局消息 8提示消息 16滚动消息
                ["szName", "TCHAR", 32],  //发送者
                ["wLength", "WORD"],  //消息长度
                ["szString", "CHINESE", 1024],  //消息内容
            ],
        }
    }
    //手机登陆
    export let CMD_GP_LogonMobile = {
        wMainCmdID: 1,
        wSubCmdID: 1,
        nLenght: 216,
        data: [
            ["dwPlazaVersion", "DWORD"],                //dwPlazaVersion广场版本
            ["dwFrameVersion", "DWORD"],       //dwFrameVersion
            ["dwProcessVersion", "DWORD"], //dwProcessVersion
            ["dwUserID", "DWORD"],        //玩家id
            ["szPassword", "TCHAR", 33],        //动态密码
            ["szServerPasswd", "TCHAR", 33],        //szServerPasswd
            ["szMachineID", "TCHAR", 33],        //szMachineID
            ["wGameID", "WORD"],                //游戏id
        ]
    }

}
